<?php

//
////返回数组中重复的数据
//function getRepeat($arr)
//{
//
//// 获取去掉重复数据的数组
//    $unique_arr = array_unique($arr);
//// 获取重复数据的数组
//    $repeat_arr = array_diff_assoc($arr, $unique_arr);
//    return $repeat_arr;
//}
//
//$arr1 = array("aaa", "bbb", "ccc", "ddd", "aaa", "bbb");
//$res = getRepeat($arr1);
//var_dump($res);
//
//
//$res2 = '[{"healthy_item_id":1021,"healthy_collector_number":"RHC21010239"},{"healthy_item_id":1021,"healthy_collector_number":"RHC21010239"}]';
//$arr = json_decode($res2, true);
//$keys='healthy_collector_number';
//
//function getRepeat1($arr, $keys)
//{
//    $unique_arr = array();
//    $repeat_arr = array();
//    foreach ($arr as $k => $v) {
//        $str = "";
//        foreach ($keys as $a => $b) {
//            $str .= "{$v[$b]},";
//        }
//        if (!in_array($str, $unique_arr)) {
//            $unique_arr[] = $str;
//        } else {
//            $repeat_arr[] = $v;
//        }
//    }
//    return $repeat_arr;
//}
//
//
//$res = getRepeat1($arr,$keys);
//var_dump($res);
//
//



//$list = array(
//    ['id' => 1,'name' => 'hahah'],
//    ['id' => 2,'name' => 'hahah'],
//    ['id' => 3,'name' => 'hagghah'],
//    ['id' => 9,'name' => 'ha545hah'],
//    ['id' => 4,'name' => 'ha54c5hah'],
//);
//$ids = array_column($list,'name');
//if (count($ids) != count(array_unique($ids)))
//    echo '重复';


$res2 = '[{"healthy_item_id":1021,"healthy_collector_number":"RHC210102329"},{"healthy_item_id":1021,"healthy_collector_number":"RHC210102329"}]';
$arr = json_decode($res2, true);

$healthy_collector_number_value = array_column($arr,'healthy_collector_number');
if (count($healthy_collector_number_value) != count(array_unique($healthy_collector_number_value)))
    echo '重复';





?>